package com.company.behavioral.interparter_pattern.terminal_expression;

import com.company.behavioral.interparter_pattern.abstract_expression.AbstractNode;

/**
 * 动作结点
 * @ClassName ActionNode
 * @Author tiezheng.han
 * @Date 2020/9/4 10:46
 **/
public class ActionNode extends AbstractNode {

    private String action;

    public ActionNode(String action) {
        this.action = action;
    }

    /**
     * 动作表达式的解释操作
     * @return
     */
    @Override
    public String interpret() {
        if (action.equalsIgnoreCase("move")){
            return "移动";
        } else if(action.equalsIgnoreCase("run")) {
          return "快速移动";
        } else {
            return "无效指令";
        }

    }
}
